package com.xtravel.common.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.xtravel.common.widget.pinnedheaderlistview.PinnedHeaderListView;

public class PullToRefreshPinnedHeaderListView extends PullToRefreshListView {
	private PinnedHeaderListView mPinnedHeaderListView;
	private boolean mNeedPinned;

	public PullToRefreshPinnedHeaderListView(Context context) {
		super(context);
	}

	public PullToRefreshPinnedHeaderListView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public PullToRefreshPinnedHeaderListView(Context context, Mode mode) {
		super(context, mode);
	}

	public PullToRefreshPinnedHeaderListView(Context context, Mode mode,
											 AnimationStyle style) {
		super(context, mode, style);
	}

	public void setPinHeaders(boolean pinned) {
		if (mPinnedHeaderListView != null) {
			mPinnedHeaderListView.setPinHeaders(pinned);
		}
	}

	@Override
	protected ListView createListView(Context context, AttributeSet attrs) {
		if (mPinnedHeaderListView == null) {
			mPinnedHeaderListView = new PinnedHeaderListView(context, attrs);
		}
		return mPinnedHeaderListView;
	}

	@Override
	public void setAdapter(ListAdapter adapter) {
		mPinnedHeaderListView.setAdapter(adapter);
	}
}
